//  let a=4;
// b=5;
// console.log(s);
// console.log(x);
// {
//     s = 89;
//     let a = 10;
//     var x = 9;
//     let y = 55;
//     console.log(a);
//     console.log(b);
//     console.log(s);
//     console.log(x);
//     console.log(y);
// }
// console.log(a);
// console.log(b);
// console.log(s);
// console.log(x);
// console.log(y);
// let a=10,b=5,c=9;
// c=a++ + b--;
// b=c-- + ++a;
// a=++b + --c;
// console.log(a);
// console.log(b);
// console.log(c);
/*let a=1,b=7,c=2;
if(a>b && b>c){
    console.log(a>b>c);
}else if(b<c){
    console.log(a>c>b);
}else if(a<b){
    console.log(b>a>c)
}else {
    console.log(c>b>a)
}*/

<script>
var arrS = [];
for (let i = 1; i < 34; i++) {
    arrS[i - 1] = i;
}

var spans = document.querySelectorAll("span");
document.querySelector("button").onclick = function () {

    /*es6 使用  set 集合会自动去除重复*/
    /*获取红球*/
    let set = new Set();
    while (set.size < 6) {
        set.add(getR(arrS, arrS.length));
    }

    /*获取篮球*/
    let set1 = new Set();
    while (set1.size < 1) {
        set1.add(getR(arrS, 16));
    }
    var hong = "";
    var lan = "";
    for (let v of set) {
        hong += v;
        hong += "   ";
    }
    for (let v of set1) {
        lan += v;
        lan += "  ";
    }

    //将内容添加到页面上
    spans[0].innerText = hong;
    spans[1].innerText = lan;
}

// 获取指定范围内的随机数
function getR(arr, al) {
    return arr[Math.floor(Math.random() * al)];
}
</script>
